package book;

/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-23
 * Time: 21:13
 */
//存储图书信息的顺序表
public class BookList {
    //表示存储信息个数
    private int usedSize;
    //存储图书信息的顺序表，初始化容量为 10
    private Book[] books = new Book[10];

    //构造方法，初始化一些图书信息
    public BookList(){
        this.books[0] = new Book("校花的贴身高手","鱼人二代","199","网络小说");
        this.books[1] = new Book("盘龙","爱吃西红柿","89","网络小说");
        this.books[2] = new Book("三国演义","罗贯中","99.9","四大名著");
        this.books[3] = new Book("红楼梦","曹雪芹","99.9","四大名著");
        //记录图书信息个数变量
        usedSize += 4;
    }

    //封装成员变量提供给外界的方法
    public int getUsedSize() {
        return usedSize;
    }
    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    //找到顺序表中第i条数据
    public Book getPos(int i){
        return books[i];
    }

    //在pos位置添加图书数据
    public void setBooks(int pos, Book book){
        books[pos] = book;
    }
}
